<?php
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
	include '../connection/connection_crimecar.php';	
	
	set_time_limit(0);
	
	$carnumber = $_REQUEST['carnumber'];
	$sql = mysql_query("select a.carnumber,co.host,a.filename 
			from alarm_display a,favourite f,configcamera co,alarm_dat d 
			where a.carnumber=d.carnumber and co.id=f.camera_ID and co.id=a.camera_id and a.carnumber='".$carnumber."' GROUP BY a.carnumber",$connection_crimecar);
	
	$r = mysql_fetch_assoc($sql);
	$datetime = explode("_",$r[filename]);
	  	$tempdate = strtotime($datetime[0]);
	  	$y = date("Y",$tempdate);
	  	$d = substr($datetime[0], -2);
	  	$ymd = date("Ymd",$tempdate);
	  	
	  	$temphour = strtotime($datetime[1]);
	  	$h = date("H",$temphour);
	  	$m = date("i",$temphour);
	  	$s = date("s",$temphour);
	  	
	  	$imga = "http://".$r[host]."/".$y."/".$ymd."/".$h."/".$m."/".$r[filename];
	  	
	  	$_SESSION['carnumber'] = $carnumber;
echo $imga;
?>

 <?php mysql_close($connection_crimecar);?>